FROM debian
ARG Name="ITPlanet"
ENV MyName="ITPlanet"
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install curl -y
RUN curl https://haproxy.debian.net/bernat.debian.org.gpg | apt-key add -
RUN echo "deb http://haproxy.debian.net $(lsb_release -cs)-backports-2.0 main" | tee /etc/apt/sources.list.d/haproxy.list
RUN apt install software-properties-common
RUN add-apt-repository ppa:vbernat/haproxy-2.0
RUN apt-get update
RUN apt-get install haproxy=2.0.\*
RUN haproxy -v
RUN HA-Proxy version 2.0.1-1~bpo9+1 2019/06/27 - https://haproxy.org/
RUN cp /etc/haproxy/haproxy.cfg{,.bak}
RUN openssl genrsa -out /etc/ssl/private/haproxy.key 2048 
RUN openssl req -new -key /etc/ssl/private/haproxy.key -out /etc/ssl/certs/haproxy.csr
RUN openssl x509 -req -days 365 -in /etc/ssl/certs/haproxy.csr -signkey /etc/ssl/private/haproxy.key -out /etc/ssl/certs/haproxy.crt
RUN cat /etc/ssl/private/haproxy.key /etc/ssl/certs/haproxy.crt >> /etc/ssl/certs/haproxy.pem
RUN haproxy -c -f /etc/haproxy/haproxy.cfg
RUN systemctl restart haproxy
RUN systemctl enable haproxy
EXPOSE 5000
